<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%String basePath = request.getContextPath(); %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册页</title>
<link rel="stylesheet" href="<%=basePath%>/resource/css/jquery-ui.css" />
<link rel="stylesheet" href="<%=basePath%>/resource/css/jquery.Jcrop.css" />
<link rel="stylesheet" href="<%=basePath%>/resource/css/common.css" />
<link rel="stylesheet" href="<%=basePath%>/resource/css/loading.css" />
<link rel="stylesheet" href="<%=basePath%>/resource/css/regist.css" />

<script type="text/javascript" src="<%=basePath%>/resource/js/common.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/constants.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/jquery/jquery-1.8.2.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/jquery/jquery.form.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/jquery/jquery.Jcrop.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/msgConstants.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/honeycombtool.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/regist.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/jquery/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="<%=basePath%>/resource/js/mydatepicker.js"></script>
</head>
<style type="text/css">
.crop_preview {
	position: absolute;
	left: 500px;
	top: 60px;
	width: 80px;
	height: 80px;
	overflow: hidden;
}

.yuantu {
	margi-left: 20px;
	border-right: 1px solid #6495ED;
	width: 450px;
	height: 350px;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
	loadPosition();
	var dateInput = $('#userRegistBirthday');
	loadDatepicker(dateInput);
});

function loadPosition(){
	$.ajax({
			url: '<%=basePath%>/position/getPositions',
			type: 'post',
			async: true,
			dataType: 'json',
			success: function(res) {
				createPositionSelect(res.positions);
			}
		});
};
function createPositionSelect(positions){
	var defaultPositionId = "hWlaWDNgTqiIbWB2tkBZhQ";
	$("#positions").html('<select name="positionId" id="select-position" style="height: 25px;"><select>');
	$.each(positions, function(i, position) {
		$("#select-position").append("<option value="+position.positionId+">"+position.positionName+"</option>");
	});
	// 不属于任何小区
	$("#select-position").append("<option value="+defaultPositionId+">其他小区</option>");
}

function img(){
	document.getElementById("randImage").src = "<%=basePath%>/user/checkcode?" + Math.random();
}
</script>
<body>
	<%@ include file="top.jsp"%>
	<div class="regist_box">
		<div class="regist-top-box">
			<div class="regist-top-main-box">
				<b>&nbsp;&nbsp;快速注册 </b> &nbsp;&nbsp;&nbsp;&nbsp;<font size="2"><b style="color: red;">*</b>号为必填项</font>
			</div>
		</div>
		<form action="<%=basePath%>/user/addregist" method="post" onsubmit="return checkRegistInfo()">

			<div class="regist-center-main-box" >

				<div class="regist-main-row-text-box">
					<div class="regist-main-row-text-main-box">
						<div class="row-text-main-name">登录邮箱：</div>
						<div class="row-text-main-input">
							<input id="userRegistEmail" maxlength="30" name="email" onblur="checkUserRegistEmail()" type="text" style="height: 25px; width: 200px;">
						</div>
						<div class="row-text-main-tag">*</div>
						<div style="clear: both;"></div>
					</div>
					<div class="regist-main-row-text-error" id="userRegistEmailError">
						
					</div>
					<div style="clear: both"></div>
				</div>
				
				<div  class="regist-main-row-text-box">
					<div class="regist-main-row-text-main-box">
						<div class="row-text-main-name">显示昵称：</div>
						<div class="row-text-main-input">
							<input id="userRegistNickname" maxlength="10" name="nickname" onblur="checkUserRegistNickname()" type="text" style="height: 25px; width: 200px;">
						</div>
						<div class="row-text-main-tag">*</div>
						<div style="clear: both;"></div>
					</div>
					<div id="userRegistNicknameError" class="regist-main-row-text-error">

					</div>
					<div style="clear: both"></div>
				</div>
				
				<div class="regist-main-row-text-box">
					<div class="regist-main-row-text-main-box">
						<div class="row-text-main-name">登录密码：</div>
						<div class="row-text-main-input">
							<input id="userRegistPassword" maxlength="20" name="userRegistPassword" onblur="checkUserRegistPassword()" type="password" style="height: 25px; width: 200px;">
						</div>
						<div class="row-text-main-tag">*</div>
						<div style="clear: both;"></div>
					</div>
					<div id="userRegistPasswordError" class="regist-main-row-text-error">

					</div>
					<div style="clear: both"></div>
				</div>
				
				<div class="regist-main-row-text-box">
					<div class="regist-main-row-text-main-box">
						<div class="row-text-main-name">确认密码：</div>
						<div class="row-text-main-input">
							<input id="userReRegistPassword" maxlength="20" name="password" onblur="checkUserReRegistPassword()" type="password" style="height: 25px; width: 200px;">
						</div>
						<div class="row-text-main-tag">*</div>
						<div style="clear: both;"></div>
					</div>
					<div id="userReRegistPasswordError" class="regist-main-row-text-error">

					</div>
					<div style="clear: both"></div>
				</div>

				<div class="regist-main-row-position-box">
					<div class="row-text-main-name">所在小区：</div>
					<div class="row-text-main-input" id="positions">
						<img src="<%=basePath %>/resource/images/pages/loading.gif" class="position-loading-img"/>
					</div>
					<div class="row-text-main-tag">*</div>
					<div style="clear: both;"></div>
				</div>
				
				<div class="regist-main-row-sex-box">
					<div class="row-text-main-name">性别：</div>
					<div style="float: left; width: 215px; height: 25px; line-height:25px;">
						<input name="sex" type="radio" value="MALE" checked="checked">男
						<input name="sex" type="radio" value="FEMALE">女
					</div>
					<div class="row-text-main-tag">*</div>
					<div style="clear: both;"></div>
				</div>
				
				<div class="regist-main-row-text-box">
					<div class="regist-main-row-text-main-box">
						<div class="row-text-main-name">您的生日：</div>
						<div class="row-text-main-input">
							<input readonly="readonly" id="userRegistBirthday" maxlength="10" style="height: 25px;" name="birthday" onchange="checkUserRegistBirthday()" value="请点击输入框选择..." type="text" />
						</div>
						<div class="row-text-main-tag">*</div>
						<div style="clear: both;"></div>
					</div>
					<div id="userReRegistBirthdayError" class="regist-main-row-text-error">

					</div>
					<div style="clear: both"></div>
				</div>
				
				<div class="regist-main-row-checkcode-box">
					
					<div class="row-text-main-name">验证码：</div>
					<div class="row-text-main-input">
						<div style="float: left; height: 25px; width: 85px;">
							<input id="yancheck" maxlength="5" type="text" style="height: 25px; width: 80px;" onblur="doCheck()">
						</div>
						<div style="float: left; height: 40px; width: 128px; font-size: 12px; margin-left: 2px;">
							<img onclick="javascript:img();" id="randImage" name="randImage" width="80px" height="30px" style="border: 1px solid #CCCCCC; cursor: pointer;" title="看不清,点击换一张" src="<%=basePath%>/user/checkcode">
							<a href="javascript:img();">换一张</a>
						</div>
						<div style="clear: both;"></div>
					</div>
					<div class="row-text-main-tag">*</div>
					<div id="docheck" class="regist-main-row-text-error"></div>
					<div style="clear: both;"></div>	
						
				</div>
				
				<div class="regist-main-submit-row-box">
					<input type="submit" class="button_style" id="regist-submit-button" style="margin-left: 20px;" value="立即注册">
					<img id="loadingImg" alt="注册中。。。" src="<%=request.getContextPath() %>/resource/images/pages/loading.gif" style="display: none; width: 45px; height: 45px;" />
					我有账号,<a href="<%=basePath%>/notice/info">去登录.</a>
				</div>
				
			</div>

		</form>
		<div class="regist-center-other-box">
		</div>
		<div style="clear: both;"></div>
	</div>
	<%@ include file="foot.jsp"%>

</body>
</html>